package org.prem.springmvc.hello;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class StudentAdmissionController13 {
	
	@RequestMapping(value="/admissionForm13",method=RequestMethod.GET)
	public ModelAndView getAdmissionForm(){
		ModelAndView modelAndView = new ModelAndView("AdmissionForm13");
		return modelAndView;
	}

	@RequestMapping(value="/submitAdmissionFormModelAttribute13",method=RequestMethod.POST)
	public ModelAndView submitAdmissionFormModelAttribute(@ModelAttribute("student") Student student){
		ModelAndView modelAndView = new ModelAndView("AdmissionSuccess13");
		return modelAndView;
	}
	
	@ModelAttribute
	public void addCommonObjects(Model model){
		System.out.println("============addCommonObjects===========");
		model.addAttribute("headerMessage", "Good Engineering College");
	}
	
	@ModelAttribute
	public void addCommonObjects2(Model model){
		System.out.println("============addCommonObjects2===========");
		model.addAttribute("headerMessage1", "Kongu Engineering College");
		model.addAttribute("headerMessage", "Good1 Engineering College");
	}
}
